﻿using AutoMapper;
using MyBlog.Model;
using MyBlog.Model.DTO;

namespace MyBlog.WebAPI;

public class CutomAutoMapperProfile:Profile
{
    public CutomAutoMapperProfile()
    {
        base.CreateMap<WriterInfo, WriterDTO>();
        base.CreateMap<BlogNews,BlogNewsDTO>()
            .ForMember(des=>des.TypeName,souce=>souce.MapFrom(src=>src.TypeInfo.Name))
            .ForMember(des=>des.WriterName,souce=>souce.MapFrom(dst=>dst.WriterInfo.Name));
    }
}
